﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HARTCalibrationTool.Observers
{
    internal class TextBoxUpdater : IObserver
    {
        private TextBox _textBox;

        public TextBoxUpdater(TextBox textBox)
        {
            _textBox = textBox;
        }
        public void Update(List<string> listStr)
        {
            if (_textBox.InvokeRequired)
            {
                _textBox.Invoke(new Action(() =>
                {
                    _textBox.Text = listStr[0];
                }));
            }
            else
            {
                _textBox.Text = listStr[0];
            }
        }
    }
}
